/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package warehouse;

import java.io.IOException;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.DefaultXYDataset;

/**
 *
 * @author Adriana
 */
public class ChartXY {

    DefaultXYDataset ds;
    JFreeChart chart;

    public ChartXY() {
        this.ds = new DefaultXYDataset();
        this.chart = null;
    }

    public void addXYDataSet(double[][] data, String seriesName) throws IOException {
        ds.addSeries(seriesName, data);
    }

    public JFreeChart createXYChart(String title, String xlabel, String ylabel) {

        this.chart = ChartFactory.createXYLineChart(
                title, xlabel, ylabel, ds, PlotOrientation.VERTICAL, true, true, false);
        return this.chart;

    }
}
